import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index'

import Login from "../views/Admin/Login";
import Main from "../views/User/Main";
import Cart from "../views/User/Cart";
import Register from "../views/User/Register";
import Order from "../views/User/Order";
import Admin from "../views/Admin/Admin";
import Book from "../views/Admin/Book";
import User from "../views/Admin/User";
import Category from "../views/Admin/Category";
import AOrder from "../views/Admin/AOrder";


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    redirect:"/main",
    component: Index,
    children: [
      {
        path: '/main',
        name: 'Main',
        component: Main
      },
      {
        path: 'cart',
        name:"Cart",
        component: Cart,
        children: []
      },
      {
        path: 'register',
        name:"Register",
        component: Register,
        children: []
      },
        {
            path: 'order',
            name:"Order",
            component: Order,
            children: []
        },
    ]
  },
  {
    path:'/admin/login',
    name:"Login",
    component: Login,
    children: []
  },
  {
    path:"/admin/main",
    name:"Admin",
    component: Admin,
    children: [
      {
        path:"/admin/book",
        name:"Book",
        component: Book,
        children: []
      },
      {
        path:"/admin/user",
        name:"User",
        component: User,
        children: []
      },
      {
        path:"/admin/category",
        name:"Category",
        component: Category,
        children: []
      },
      {
        path:"/admin/order",
        name:"AOrder",
        component: AOrder,
        children: []
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
